<template>
  <div>
    <h3>{{num}}</h3>
    <Child ref="child"/>
  </div>
</template>

<script>
  import Child from "./Child";
  export default {
    name: "App",
    components:{
      Child
    },
    data(){
      return {
      num:0
      }
    },
    mounted() {
      this.$refs.child.$on('add',(x,y)=>{
        this.num+=x+y
      })
    }
  }
</script>

<style scoped>

</style>